<?php

/**
 *      
 * 
 *  @author          Edmandie Samonte        (edmandie.samonte@gmail.com)
 *  @copyright       2011 
 * 
 */
class Error extends CI_Controller{
    
    
    function error_404(){
        $data['title'] = "Page Not Found";
        $data['message'] = "Error 404 : Page Not Found";
        $data['description'] = "We cannot find the page you want to access. Please make sure you type the URL correctly.Thank you. Click <a href='". site_url('dashboard')."'>here</a> to go back to dashboard.";
        $this->_send($data);
    }
    
    function profile(){
        $data['title'] = "Profile Not Found";
        $data['message'] = "Error 404 : Profile Not Found";
        $data['description'] = "We cannot find the employee's profile you want to access. Please make sure you type the URL correctly.Thank you. Click <a href='". site_url('dashboard')."'>here</a> to go back to dashboard.";
        $this->_send($data);
    }
    
    function cookie(){
        $data['title'] = "Cookie Error";
        $data['message'] = "Session Cookie has been Altered";
        $data['description'] = "Our system detected that your session cookie has been altered. Click <a href='". site_url()."'>here</a> to re-login. ";
        $this->_send($data);
    }
    
    function _send($data){
        $this->load->database();
        $this->db->select('posID');
        $this->db->where('posName',"System Administrator");
        $res = $this->db->get('positions')->result();
        
        $emp = $this->db->get_where('employee',array('ePosition'=>$res[0]->posID))->result();
        
        $data['description'] .="<br/><br/>If this error continues, contact your administrator : <br/><ul style='list-style-type:square'>";
        foreach($emp as $e){
            $data['description'] .= "<li>" . $e->eFirstName . " ". $e->eMiddleName . " " . $e->eLastName . " " 
                    . "<a href='mailto:".$e->eEmail."'>".$e->eEmail ."</a>" . "</li>";
        }
        $data['description'] .= "</ul>";
        $this->load->helper('HTML');
        $this->load->view('error',$data);
    }
}

?>
